<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>支付页面</title>
</head>
<body>
<form method="post" action="" id="news">
    <input type="button" value="支付" id="pay">
</form>
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script>

    $("#pay").click(function () {
        //保存订单
        var orderNews="companyId=1&activeId=1&payCount=12";
        $.get("/saveOrder.json",orderNews,function (data) {
              if(data.result==1){
                  //支付订单
                  var payNews="companyId=1&payCount=12&orderNumber="+data.orderNumber;
                  $.get("/pay.do",payNews,function (data) {
                      $("body").empty();
                      $("body").append(data);
                  },"text");
              }else {
                  alert("下单失败，请重新下单！");
              }
        },"json")


    });

</script>
</body>
</html>